package com.andriology.logic;

import android.os.Parcel;
import android.os.Parcelable;

public class TestQuestion implements Parcelable{

	public static final int MAX_NUM_OF_CHOICES = 3;
	public static final int INDEX_OF_CHOICE_1 = 0;
	public static final int INDEX_OF_CHOICE_2 = 1;
	public static final int INDEX_OF_CHOICE_3 = 2;
	public static final int QUESTION_OFFSET = 1;
	public static final int HIGH_WEIGHT = 99;
	public static final int MID_WEIGHT = 66;
	public static final int LOW_WEIGHT = 33;
	public static final int INITIAL_WEIGTH = 0xFFFF;
	/*public static final int FINAL_MARK = 13;*/
	
	private String Question;
	private String [] choices;
	private int [] choicesWeights;
	private int chosenAnswerWeight = INITIAL_WEIGTH;

	public void setChosenAnswerWeight(int chosenAnswerWeight) {
		this.chosenAnswerWeight = chosenAnswerWeight;
	}

	public int getChosenAnswerWeight() {
		return chosenAnswerWeight;
	}

	public String getQuestion() {
		return Question;
	}

	public void setQuestion(String question) {
		Question = question;
	}


	public int[] getchoicesWeights() {
		return choicesWeights;
	}

	public void setchoicesWeights(int[] weightsArray) {
		choicesWeights = weightsArray;
	}

	public String[] getChoices() {
		return choices;
	}

	public void setChoices(String[] choices) {
		this.choices = choices;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
		
		out.writeString(Question);
		out.writeIntArray(choicesWeights);
		out.writeStringArray(choices);
		out.writeInt(chosenAnswerWeight);
	}
	
	public static final Parcelable.Creator<TestQuestion> CREATOR =  new Parcelable.Creator<TestQuestion>() {

			@Override
			public TestQuestion createFromParcel(Parcel source) {
				return new TestQuestion(source);
			}

			@Override
			public TestQuestion[] newArray(int size) {
				return new TestQuestion[size];
			}
		};
		public TestQuestion(Parcel in) {
			choices = new String[MAX_NUM_OF_CHOICES];
			choicesWeights = new int [MAX_NUM_OF_CHOICES];
			
			Question = in.readString();
			in.readIntArray(choicesWeights);
			in.readStringArray(choices);
			chosenAnswerWeight = in.readInt();
		}

		public TestQuestion() {
			chosenAnswerWeight = INITIAL_WEIGTH;
		}
}
